// SETUP

#include endepisodegraphics_other.txt

// HELPER FUNCTIONS	

function signanimate(sign) {
	var s = sign.show("turn");
	//s.onComplete(function() { resume(); sign.show("loop"); });
	//pause();
	while(!s.completed) {
		// do nothing
	}
	sign.show("loop");
}

function spinthewheel(sign, wheel) {
  var s = sign.show("turn");
	//s.onComplete(function() { resume(); sign.show("loop"); });
	//pause();
	while(!s.completed) {
		// do nothing
	}
	sign.hide();
	
  wheel.x = 30;
  wheel.y = -30;
  play("spinthewheel");
	var s = wheel.show("spin1");
	//s.onComplete(function() { resume(); sign.show("loop"); });
	//pause();
	while(!s.completed) {
		// do nothing
	}
	wheel.hide();
}

// ACTORS

actor("Baby Squid", screenwidthmid + 400, 100, 0xfda8ff, LEFT, TOP, "chat_monster1");
actor("Warrior", 150, screenheight - 100, Col.LIGHTBLUE, LEFT, BOTTOM, "chat_warrior", "characters/warrior/charicon_warrior");

// INTRO

play("music_cutscene_lesscheery");

changebackground("intro_sign");

sign.y = -screenheight;
babysquid.y = -screenheight;
sign.show("loop");
babysquid.show("idle");

Actuate.tween(sign, 2, { y: 0 }).ease(Expo.easeOut);
Actuate.tween(babysquid, 2, { y: 0 }).ease(Expo.easeOut);

wait(0.5);

fadein();

wait(1.5);

babysquid.show("talking");
speak("Baby Squid", "...Hey! It’s you! Hey, it’s so|good to see you!");
actor("Baby Squid", screenwidthmid, 100, 0xfda8ff, LEFT, TOP, "chat_monster1");
speak("Baby Squid", "Um, I’m just filling in here but I’m meant to|tell you that I’m going to spin the wheel...");
speak("Baby Squid", "...and then when you lose I’m meant to say|'better luck next time', I think?");
actor("Baby Squid", screenwidthmid + 400, 100, 0xfda8ff, LEFT, TOP, "chat_monster1");
speak("Baby Squid", "Okay! Yes! Here we go!");
babysquid.show("idle");

babysquid.hide();

spinthewheel(sign, wheel);

signanimate(sign);

babysquid.show("talking");
speak("Baby Squid", "Better luck next time!");
babysquid.show("idle");

gamecompletefromcutscene();
